Skip to content

Feature/refactory install module#211

Closed
ClausKlein wants to merge 22 commits intobemanproject:module-testfrom
ClausKlein:feature/refactory-install-module
Closed

Feature/refactory install module#211
ClausKlein wants to merge 22 commits intobemanproject:module-testfrom
ClausKlein:feature/refactory-install-module

Conversation

@ClausKlein
Copy link
Collaborator

@ClausKlein ClausKlein commented Feb 2, 2026

Installing a Library

Installation is handled by the beman_install_library() helper.

Function Signature

beman_install_library(name
    TARGETS <target1> [<target2> ...]
    [DEPENDENCIES <dep1> [<dep2> ...]]
    [NAMESPACE <namespace>]
    [EXPORT_NAME <export-name>]
    [DESTINATION <module-destination>]
)

Arguments

  • name
    Logical package name (e.g. "beman.utility").
    Used to derive config file names and cache variable prefixes.

  • TARGETS
    Targets to install and export.

  • DEPENDENCIES (optional)
    Semicolon-separated list, one dependency per entry.
    Each entry is a valid find_dependency() argument list.

    NOTE: you must use the bracket form for quoting if not only a package name is used!

    "[===[beman.inplace_vector 1.0.0]===] [===[beman.scope 0.0.1 EXACT]===] fmt"

  • NAMESPACE (optional)
    Namespace for imported targets.
    Defaults to "beman::".

  • EXPORT_NAME (optional)
    Name of the generated CMake export set.
    Defaults to "-targets".

  • DESTINATION (optional)
    Installation directory for C++ module interface units.
    Defaults to ${CMAKE_INSTALL_INCLUDEDIR}/beman/modules.

This function installs the specified project TARGETS and its FILE_SET TYPE HEADERS to the default CMAKE install destination.

It also handles the installation of the CMake config package files if
needed. If the given targets has FILE_SET TYPE CXX_MODULE, it will also
installed to the given DESTINATION

  • *Used Cache variables

BEMAN_INSTALL_CONFIG_FILE_PACKAGES
List of package names for which config files should be installed.

<PREFIX>_INSTALL_CONFIG_FILE_PACKAGE
Per-package override to enable/disable config file installation.
is the uppercased package name with dots replaced by underscores.

Caveats

Only one FILE_SET of each TYPE is supported to install with this function yet!


@ClausKlein ClausKlein self-assigned this Feb 2, 2026
@ClausKlein ClausKlein requested a review from ednolan February 2, 2026 14:52
@ClausKlein ClausKlein marked this pull request as draft February 2, 2026 14:52
Comment on lines 129 to 160
#======================================================================
# NOTE: Only for Release build with enabled install rules useful! CK
#======================================================================
if(BEMAN_EXECUTION_INSTALL_CONFIG_FILE_PACKAGE AND NOT CMAKE_SKIP_INSTALL_RULES)
# test if the targets are usable from the install directory
add_test(
NAME install-to-stagedir
COMMAND
${CMAKE_COMMAND} --install ${CMAKE_BINARY_DIR} --prefix
${CMAKE_BINARY_DIR}/stagedir --config $<CONFIG>
)
add_test(
NAME find-package-test
COMMAND
${CMAKE_CTEST_COMMAND} # --verbose
--output-on-failure -C $<CONFIG> #
--build-and-test "${CMAKE_SOURCE_DIR}/examples"
"${CMAKE_CURRENT_BINARY_DIR}/find-package-test" #
--build-generator ${CMAKE_GENERATOR} #
--build-makeprogram ${CMAKE_MAKE_PROGRAM} #
--build-options #
"-D BEMAN_USE_MODULES=${BEMAN_USE_MODULES}"
"-D CMAKE_BUILD_TYPE=$<CONFIG>"
"-D CMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}"
"-D CMAKE_CXX_EXTENSIONS=${CMAKE_CXX_EXTENSIONS}"
"-D CMAKE_CXX_MODULE_STD=${CMAKE_CXX_MODULE_STD}"
"-D CMAKE_CXX_SCAN_FOR_MODULES=${CMAKE_CXX_SCAN_FOR_MODULES}"
"-D CMAKE_CXX_STANDARD=${CMAKE_CXX_STANDARD}"
"-D CMAKE_CXX_STANDARD_REQUIRED=${CMAKE_CXX_STANDARD_REQUIRED}"
"-D CMAKE_PREFIX_PATH=${CMAKE_BINARY_DIR}/stagedir"
)
endif()
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This add a test to build examples with the installed targets

set(CMAKE_CXX_FLAGS_DEBUG_INIT "${SANITIZER_FLAGS}")

set(RELEASE_FLAGS "-O3 ${SANITIZER_FLAGS}")
set(RELEASE_FLAGS "-O3")
Copy link
Collaborator Author

@ClausKlein ClausKlein Feb 2, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do not add sanitizer flags for Release builds, it would be exported!

see bemanproject/infra#14

"tests": ["Debug.Default", "Release.Default", "Release.MaxSan"]
"tests": [
"Debug.Default", "Debug.MaxSan",
"Release.Default", "Release.Dynamic"
Copy link
Collaborator Author

@ClausKlein ClausKlein Feb 2, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For Windows, static and dynamic must be build in Release and tested after install!

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dietmarkuehl or may dynamic libraries now the problem?

@ClausKlein ClausKlein marked this pull request as ready for review February 6, 2026 08:32
@ClausKlein ClausKlein changed the base branch from main to module-test February 6, 2026 08:40
Comment on lines 36 to 38
if(NOT APPLE)
return()
endif()
Copy link
Collaborator Author

@ClausKlein ClausKlein Feb 6, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@nickelpro @camio @JeffGarland Changed after review!

Now all non preset tests on UNIX CI workflows fails

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we know why these builds fail and is that something which can be fixed? I had a brief look but couldn’t actually spot a reason for the failure.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we know why these builds fail and is that something which can be fixed? I had a brief look but couldn’t actually spot a reason for the failure.

line 37 above

@ClausKlein ClausKlein marked this pull request as draft February 6, 2026 11:46
Comment on lines 93 to 97
option(
BEMAN_USE_STD_MODULE
"Check if 'import std;' is possible with the toolchain?"
OFF
ON
)
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dietmarkuehl this seems to cause the CI problems!

@dietmarkuehl dietmarkuehl deleted the branch bemanproject:module-test February 6, 2026 19:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants